$(function () {
  const layer = layui.layer
  // 表单提交事件
  $('#formReg').on('submit',function(e){
    e.preventDefault()
    const data = $(this).serialize()
    // console.log(data)

    $.ajax({
      method:'POST',
      url:'http://124.223.14.236:3001/api/user/reg',
      data,
      success:function(res){
        if(!res.success) return layer.msg('注册失败')
        layer.msg('注册成功')
        setTimeout(function(){
          location.href = '/loginBaseCode/login.html'
        },800)
      }
    })
  })
})